package net.xiduth.game.player.dialogues;

public class CaptainJute extends Dialogue {

	private int npcId;

	@Override
	public void start() {
		npcId = (Integer) parameters[0];
		sendNPCDialogue(npcId, 9827, "Hey " + player.getDisplayName()
				+ ", do you need something?");
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			sendOptionsDialogue("Captain Jute - Troll Invasion",
					"I would like to enter the instance.",
					"Can I see the reward shop?",
					"How do I obtain more points?",
					"How many points do I have?",
					"Never mind.");
			stage = 2;
		} else if (stage == 2) {
			if (componentId == OPTION_1) {
				sendNPCDialogue(npcId, 9827, "Good luck, brave warrior.");
				player.getControlerManager().startControler("TrollInvasion", 1);
				end();
			}
			if (componentId == OPTION_4) {
				sendNPCDialogue(npcId, 9827,
						"You currently have " + player.getTrollPoints()
								+ " T.I Points.");
				stage = -1;
			}
			if (componentId == OPTION_3) {
				sendNPCDialogue(
						npcId,
						9827,
						"Points are obtained by completing the instance. Complete more waves for more points!");
				stage = -1;
			}
			if (componentId == OPTION_5) {
				end();
				stage = 3;
			}
			if (componentId == OPTION_2) {
				player.getInterfaceManager().sendTrollShop();
				end();
				stage = 3;
			}
		} else if (stage == 3) {
			end();
		}
	}

	@Override
	public void finish() {

	}

}